package xjvm_v1.classfile.cons;

import xjvm_v1.util.TypeTransUtil;
import xjvm_v1.util.U2;

public class ConstantMethodref extends ConstantBase {
    public U2 classIndex;
    public U2 nameAndTypeIndex;

    public String handle(ConstantBase[] cpInfo){

        Integer cI = TypeTransUtil.byteArr2Int(classIndex.u2);
        String className = cpInfo[cI].handle(cpInfo);

        Integer nI = TypeTransUtil.byteArr2Int(nameAndTypeIndex.u2);
        String nameAndType = cpInfo[nI].handle(cpInfo);
        return className + "." + nameAndType;
    }
}
